<template>
    <div>
        <button @click="isShow=!isShow">显示/隐藏</button>
        <!-- <h1 v-show="isShow" class="come">你好啊!</h1> -->
        <transition name="hello" appear>
            <h1 v-show="isShow">你好啊!</h1>
        </transition>
        <div class="red-bg"></div>
    </div>
</template>

<script>
    export default {
        name: 'stuTest',
        data () {
            return {
                isShow: true
            }
        }
    }
</script>

<style scoped>
    h1 {
        background: orange;
    }
    /* .red-bg {
        width: 400px;
        height: 300px;
        background: red;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    } */
    .hello-enter-active {
        animation: atguigu 1s;
    }
    .hello-leave-active {
        animation: atguigu 1s reverse;
    }
    .v-enter-active {
        animation: atguigu 1s;
    }
    .v-leave-active {
        animation: atguigu 1s reverse;
    }

    .come {
        animation: atguigu 1s;
    }
    .to {
        animation: atguigu 1s reverse;
    }
    @keyframes atguigu {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0px);
        }
    }
</style>